/**
 * 订单销售报表
 */
import { getRequest, getDownload } from '@/lib/axios'
interface OrderReportApi {
  queryList: (param: { page?: number | null; limit?: number | null; report_type: number }) => Promise<any>
  exportOrderReport: (params?: any) => void
}
export const orderReportApi: OrderReportApi = {
  // 订单销售汇总
  queryList: (param) => {
    return getRequest('/order/report', param)
  },
  // 导出
  exportOrderReport: (param) => {
    return getDownload('/order/export_order_report', param)
  }
}

/**
 * 商品销售报表
 **/

interface GoodsReportApi {
  queryList: (param: { page?: number | null; limit?: number | null; report_type: number }) => Promise<any>
  querySalesmanGoodsReport: (param: { page?: number | null; limit?: number | null }) => Promise<any>
  querySalesmanGoodsDetail: (param: { page?: number | null; limit?: number | null; goods_id: number; salesman_id: number; order_type?: number; create_time?: string; warehouse_id?: number; store_name?: string }) => Promise<any>
  exportGoodsReport: (params?: any) => void
}
export const goodsReportApi: GoodsReportApi = {
  // 商品销售汇总
  queryList: (param) => {
    return getRequest('/order/goods_report', param)
  },
  // 业务员商品销售汇总
  querySalesmanGoodsReport: (param) => {
    return getRequest('/order/sales_summary', param)
  },
  // 业务员商品销售明细
  querySalesmanGoodsDetail: (param) => {
    return getRequest('/order/sales_summary_detail', param)
  },
  // 导出
  exportGoodsReport: (param) => {
    return getDownload('/order/export_goods_report', param)
  }
}

/**
 * 签收明细汇总
 **/
interface OrderSignReportApi {
  queryList: (param: { page?: number | null; limit?: number | null; type: number; name?: string }) => Promise<any>
  driverSignReport: (param: { page?: number | null; limit?: number | null; type: number; name?: string }) => Promise<any>
  exportReport: (params?: any) => void
}
export const orderSignReportApi: OrderSignReportApi = {
  // 签收明细汇总
  queryList: (param) => {
    return getRequest('/order_sign/report', param)
  },
  // 签收明细汇总(司机)
  driverSignReport: (param) => {
    return getRequest('/order_sign/driver_sign_report', param)
  },
  // 导出
  exportReport: (param) => {
    return getDownload('/order_sign/export_report', param)
  }
}
